//
//  MyGreeter.swift
//  Re-mygreetings
//
//  Created by Jia Chen on 2022/8/9.
//

import UIKit

class MyGreeterClient: NSObject {
    
    static func getMyGreeter() -> String {
        let curHMS = DateTool.getHourMinSec(date: Date())
        let h = curHMS.0
//        let m = curHMS.1
//        let s = curHMS.2
        return self.triggerMyGreets(h: h)
    }
    
    static func triggerMyGreets(h: Int) -> String {
                        
        guard h >= 0 && h < 24 else {
//            print("error!")
            return "error"
        }
        
        if h >= 6 && h < 12 {
//            print("Good morning")
            return "Good morning"
        } else if h >= 12 && h < 18 {
//            print("Good afternoon")
            return "Good afternoon"
        } else {
//            print("Good evening")
            return "Good evening"
        }
        
    }

}
